[ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0
MY_HOME="$(cd "$(dirname "$SCRIPT_NAME")" && pwd -P)"
echo "INFO: MY_HOME: ${MY_HOME}"
echo "INFO: apt installing dependencies: sudo apt install cmake libopenblas-dev liblapack-dev libarpack2-dev libsuperlu-dev"
sudo apt install cmake libopenblas-dev liblapack-dev libarpack2-dev libsuperlu-dev unzip -y
cd ${MY_HOME}/third_source
# 安装armadillo-12.4.2
echo "INFO: 安装armadillo-12.4.2"
tar -xf armadillo-12.4.2.tar.xz
cd armadillo-12.4.2/
mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=~/lib/armadillo-12.4.2
make
make install

# 安装glog-0.6.0
cd ${MY_HOME}/third_source
echo "INFO: 安装glog-0.6.0"
unzip glog-0.6.0.zip
cd glog-0.6.0/
mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=~/lib/glog-0.6.0
make
make install

# 安装googletest-1.14.0
cd ${MY_HOME}/third_source
echo "INFO: googletest-1.14.0"
unzip googletest-1.14.0.zip
cd googletest-1.14.0
mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=~/lib/googletest-1.14.0
make
make install

# 清理一下安装目录
cd ${MY_HOME}/third_source
echo "INFO: cleaning..."
rm -rf armadillo-12.4.2  glog-0.6.0 googletest-1.14.0




